package wwy.Controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import wwy.Dao.CatalogueDao;
import wwy.Dto.CatalogueDto;
import wwy.Dto.ReadingDto;
import wwy.Entity.Catalogue;
import wwy.Service.ReadingService;

import java.util.List;

@RestController
@Tag(name = "reading", description = "书籍阅读" )
@RequestMapping("/reading")
public class ReadingController extends LogicController<ReadingService, CatalogueDao, Catalogue, Long> {
    public ReadingController(ReadingService service) {
        super(service);
    }

    @GetMapping("/info")
    @Operation(summary = "获取书籍阅读信息")
    public ReadingDto getReadingInfo(String bookName) {
        return service.getReadingInfo(bookName);
    }

    @GetMapping("/catalogue")
    @Operation(summary = "获取目录")
    public List<CatalogueDto> getCatalogues(String bookName) {
        return service.getBookCatalogues(bookName);
    }
}


